package com.hz.sdka.commona.utils;

import android.content.Context;
import android.util.DisplayMetrics;

import com.hz.sdka.commona.SDKContext;

/*进制转换*/
public class ConvertUtils {
    private ConvertUtils() {
        throw new UnsupportedOperationException("u can't instantiate me...");
    }

    public static int dip2px(Context context, float dpValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dpValue * scale + 0.5f);
    }

    public static int getScreenWidth() {
        DisplayMetrics dm = SDKContext.getInstance().getContext().getResources().getDisplayMetrics();
        return dm.widthPixels; // 屏幕的宽度
    }

}
